package com.zy.bean3;

import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.PropertySource;

import java.sql.Connection;

@Configuration
@ComponentScan
@PropertySource("classpath:db.properties")
public class App3 {
    public static void main(String[] args) {
        ApplicationContext ac = new AnnotationConfigApplicationContext(App3.class);
        DBUtil dbUtil = ac.getBean(DBUtil.class);
        Connection con = dbUtil.getCon();
        System.out.println(con);
    }
}
